<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial - scale=1.0">
    <link rel="stylesheet" href="../static/css/behindManager.css" th:href="@{/css/behindManager.css}">
    <link rel="stylesheet" href="../static/css/iconfont.css" th:href="@{/css/iconfont.css}">
    <link rel="stylesheet" href="../static/css/confirm.css" th:href="@{/css/confirm.css}">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <title>帖子添加</title>
</head>
<body>
<div class="box">
    <div class="nav-container">
        <div class="logo">
            <img src="../static/img/logo.png" alt="Ant Design Pro" th:src="@{/img/logo.png}">
            <p class="name">Haven Manager</p>
        </div>
        <div class="user-info">
            <span class="username">后台管理</span>
        </div>
        <ul class="nav">
            <li><a href="http://localhost:8080/admin/behindManagerUser" th:href="@{/admin/behindManagerUser}"  data-target="adminManagement" class="nav-link ">用户管理</a></li>
            <li><a href="http://localhost:8080/admin/behindManagerPost" th:href="@{/admin/behindManagerPost}" data-target="systemManagement" class="nav-link active">帖子管理</a></li>
            <li><a href="http://localhost:8080/admin/behindManagerCategory" th:href="@{/admin/behindManagerCategory}" data-target="kindManagement" class="nav-link">类别管理</a></li>
            <li><a href="http://localhost:8080/admin/behindManagerReport" th:href="@{/admin/behindManagerReport}" data-target="jubaoManager" class="nav-link">举报管理</a></li>
        </ul>
    </div>
<a href="http://localhost:8080/mainPageRecommend" th:href="@{/mainPageRecommend}" style="position: static"><button class="back" style="z-index: 100">返回首页</button></a>
<a href="" class="person"><img src="../static/img/image1.png " alt=""  th:src="${admin.avatar}">
    <div class="admin-name"  th:text="${admin.username}">烧饼</div></a>
    <div id="systemManagement" class="content">
        <div class="admin-content">
                <!-- 提示信息区域：当 info 非空时显示 -->
            <div th:if="${postsList == null || postsList.isEmpty()}" class="alert alert-info" th:each="info : ${info}">
                <p style="position: absolute;top: 300px;left: 400px;font-size: 22px;font-weight: 700;" id="noPost">没有未审核的帖子</p>
            </div>
            <div>
                    <button id="check-button">全部驳回</button>
                    <button id="pass-button">全部通过</button>
                    <input type="text" id="check" class="checked" placeholder="请输入标题">
                     <button id="checkkey-button" class="add-button">查询</button>
                <div><i class="iconfont" id="backform" >&#xe61b;</i></div>
                <table class="adminManagement-table">
                <thead>
                <div>
                    <p id="notice" style="position: absolute;top: 300px;left: 400px;font-size: 22px;font-weight: 700; display: none">没有找到该帖子</p>
                </div>
            <tr>
                <th><input type="checkbox" class="selectAll"></th>
                <th>昵称</th>
                <th>帖子标题</th>
                <th>发布时间</th>
                <th>帖子内容</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="postList">
             <tr th:each="post : ${postsList}">
                <td><input type="checkbox" class="rowCheckbox" th:value="${post.id}" th:data-id="${post.id}"></td>
                <td  class="title-cell" th:text="${post.userId}"></td>
                <td class="title-cell" th:text="${post.title}"></td>
                <td th:text="${post.createdAt}"></td>
                <td>
                    <div class="contents" th:text="${post.content}"></div>
                    <img th:src="${post.imageUrl}" alt="科技图片" style="width: 70px; height: 70px;"
                         th:attr="src=${post.imageUrl!= null? post.imageUrl : 'https://picsum.photos/200/150'}" class="imgs">
                </td>
                <td>
                    <button class="editbtn text-xl" th:data-id="${post.id}">详情</button>
                    <button class="deletebtn" th:data-id="${post.id}">驳回</button>
                    <button class="editbtns text-xl" th:data-id="${post.id}">通过</button>
                </td>
            </tr>
            </tbody></table>
        <div class="pagination" id="pageNav"></div>
    </div>  </div>
    <div id="editModal" class="modal" style="display: none;">
        <div class="bg">
            <div class="title-edit">详情栏</div>
            <ul>
            <li><label for="namePostTitle" class="lable1">昵称为：<input type="text" id="namePostTitle" class="PostTitle" placeholder="昵称" style="margin-left: 15px;"></label></li>
            <li><label for="editPostTitle" class="lable1">标题为：<input type="text" id="editPostTitle" class="EditPostTitle" placeholder="帖子标题" ></label></li>
            <li><label class="lable1">内容为：</label> </li>
            <div id="editPostContentDivs" class="border border-gray-300 p-2 rounded-md w-full h-32 mb-2"
                 style="overflow-y: auto; white-space: pre-line; margin-top: -19px; margin-left: 92px;" contenteditable="true"></div></ul>
            <button class="cancelEditPost" style="margin-left: 530px; margin-top: 41px;" >返回</button>
        </div>
    </div>
    </div> </div>
<script th:inline="javascript">
    let posts = [[${postsList}]];
    console.log(posts)
</script>
    <script src="../static/js/behindManagerPost.js" th:src="@{/js/behindManagerPost.js}"></script>
</body>

</html>